package com.liqw.auto.beanfactory;

import com.liqw.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.stereotype.Component;

// ======================== Bean定义注册后处理器 ========================
@Slf4j
@Component
public class CustomBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {

    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
        System.out.println(Constant.getStepStr("CustomBeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry") + "CustomBeanDefinitionRegistryPostProcessor - postProcessBeanDefinitionRegistry : ");
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        System.out.println(Constant.getStepStr("CustomBeanDefinitionRegistryPostProcessor.postProcessBeforeInitialization") + "CustomBeanDefinitionRegistryPostProcessor - postProcessBeanFactory");
    }
}